<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>员工列表</title>
</head>
<body>
    <div align="center">
        <h1>员工列表</h1>
        <hr>
        <div><a href="/test_orm_old/add_employee_old/">增加一条记录</a></div>
        <table border="1">
            <thead>
                <tr>
                    <td>姓名</td>
                    <td>邮箱</td>
                    <td>薪水</td>
                    <td>地址</td>
                    <td>部门</td>
                    <td>团队</td>
                    <td colspan="2">操作</td>
                </tr>
            </thead>
            <tbody>
            <!--    dep_list即为类视图list_dep_old()中render传入的参数        -->
            {% for emp in emp_list %}
            <tr>
                <td>{{emp.name}}</td>
                <td>{{emp.email}}</td>
                <td>{{emp.salary}}</td>
                <td>{{emp.info.address}}</td>
                <td>{{emp.dep.dep_name}}</td>
                <td>
                    {% for gp in emp.group.all %}
                    {% if forloop.last %}
                    {{gp.group_name}}
                    {% else %}
                    {{gp.group_name}},
                    {% endif %}
                    {% endfor %}
                </td>
                <td><a href="/test_orm_old/del_employee_old/{{emp.id}}/">删除</a></td>
                <td><a href="/test_orm_old/edit_employee_old/{{emp.id}}/">修改</a></td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="7">无相关记录</td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</body>
</html>